#ifndef USERPANEL_H
#define USERPANEL_H
#include<iostream>
using std::cin; using std::cout; using std::endl; using std::string;
#include<vector>
using std::vector;
#include<fstream>
using std::ifstream;
#include<memory>
using std::shared_ptr; using std::make_shared;
#include<stdlib.h>
#include<set>

class TextQuery;
class InputParser;
class UserPanel{
    public:
        UserPanel(TextQuery&);
        UserPanel(TextQuery&,string&);
        void showMenu();
        void makeChoice(const char&);
        void runSearch();
        void showText();
        void searchHistory();
 
    private:
        shared_ptr<TextQuery> p_textquery_; //用于查询的文本类
        shared_ptr<InputParser> p_ipaser_;  //输入处理依赖一个专门的类实现
        vector<string> history_;
        string historyFilePath;
        string getInput();                  // 接受输入并返回处理后的输入(去空格)
        bool checkQueryInp(const string &str);
        void refresh();
        void pause();
        void loadHistory();
        void saveHistory();
};

#endif